package com.cskaoyan.bean.zhao_order_bean;

import java.util.List;

/**
 * <h3>market</h3>
 *
 * @author:Zhao
 * @date:2021-10-21 11:21:48
 * @description:
 */
public class WxOrderListVO {


    /**
     * orderStatusText : 未付款
     * aftersaleStatus : 0
     * isGroupin : false
     * orderSn : 20211021477506
     * actualPrice : 7997.0
     * goodsList : [{"number":2,"picUrl":"http://yanxuan.nosdn.127.net/c5be2604c0e4186a4e7079feeb742cee.png","price":3999,"id":39,"goodsName":"云端沙发组合","specifications":["标准"]}]
     * id : 37
     * handleOption : {"cancel":true,"confirm":false,"rebuy":false,"pay":true,"comment":false,"delete":false,"aftersale":false,"refund":false}
     */
    private String orderStatusText;//数据库中存的是状态码，用反射赋值
    private Integer orderStatus;

    private int aftersaleStatus;//aftersale_status
    private boolean isGroupin;//是否团购??怎么处理
    private String orderSn; //order_sn
    private double actualPrice;//actual_price


    private List<GoodsListEntity> goodsList; //怎样赋值的?
    private int id;


    private boolean deleted;
    private HandleOptionEntity handleOption = new HandleOptionEntity();

    public void setOrderStatus(Integer orderStatus) {
        if (orderStatus == 101) {

            this.orderStatusText = "未付款";
            this.handleOption.pay = true;
            this.handleOption.cancel = true;


        } else if (orderStatus == 102) {

            this.orderStatusText = "已取消（用户）";
            this.handleOption.cancel = false;
            this.handleOption.delete = true;

        } else if (orderStatus == 103) {

            this.orderStatusText = "已取消（系统）";
            this.handleOption.cancel = false;
            this.handleOption.delete = true;

        } else if (orderStatus == 201) {

            this.orderStatusText = "已付款";
            this.handleOption.pay = false;
            this.handleOption.refund = true;

        } else if (orderStatus == 202) {

            this.orderStatusText = "申请退款";

        } else if (orderStatus == 203) {

            this.orderStatusText = "已退款";
            this.handleOption.refund = false;
            this.handleOption.delete = true;

        } else if (orderStatus == 301) {

            this.orderStatusText = "已发货";
            this.handleOption.confirm = true;

        } else if (orderStatus == 401) {

            this.orderStatusText = "用户收货";
            this.handleOption.confirm = false;
            this.handleOption.comment = true;
            this.handleOption.delete = true;
            this.handleOption.aftersale = true;
            this.handleOption.rebuy = true;

        } else if (orderStatus == 402) {

            this.orderStatusText = "系统收货";
            this.handleOption.confirm = false;
            this.handleOption.comment = true;
            this.handleOption.delete = true;
            this.handleOption.aftersale = true;
            this.handleOption.rebuy = true;
        }

//        this.orderStatus = orderStatus;
    }

    public void setDeleted(boolean deleted) {
        if (deleted == true) {
            this.handleOption.delete = true;
        }
        this.deleted = deleted;
    }

    public void setOrderStatusText(String orderStatusText) {
        this.orderStatusText = orderStatusText;
    }

    public void setAftersaleStatus(int aftersaleStatus) {
        this.aftersaleStatus = aftersaleStatus;
    }

    public void setIsGroupin(boolean isGroupin) {
        this.isGroupin = isGroupin;
    }

    public void setOrderSn(String orderSn) {
        this.orderSn = orderSn;
    }

    public void setActualPrice(double actualPrice) {
        this.actualPrice = actualPrice;
    }

    public void setGoodsList(List<GoodsListEntity> goodsList) {
        this.goodsList = goodsList;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setHandleOption(HandleOptionEntity handleOption) {
        this.handleOption = handleOption;
    }

    public String getOrderStatusText() {
        return orderStatusText;
    }

    public int getAftersaleStatus() {
        return aftersaleStatus;
    }

    public boolean isIsGroupin() {
        return isGroupin;
    }

    public String getOrderSn() {
        return orderSn;
    }

    public double getActualPrice() {
        return actualPrice;
    }

    public List<GoodsListEntity> getGoodsList() {
        return goodsList;
    }

    public int getId() {
        return id;
    }

    public HandleOptionEntity getHandleOption() {
        return handleOption;
    }


    public class HandleOptionEntity {
        /**
         * cancel : true
         * confirm : false
         * rebuy : false
         * pay : true
         * comment : false
         * delete : false
         * aftersale : false
         * refund : false
         */
        private boolean cancel;
        private boolean confirm;
        private boolean rebuy;
        private boolean pay;
        private boolean comment;
        private boolean delete;
        private boolean aftersale;
        private boolean refund;

        public void setCancel(boolean cancel) {
            this.cancel = cancel;
        }

        public void setConfirm(boolean confirm) {
            this.confirm = confirm;
        }

        public void setRebuy(boolean rebuy) {
            this.rebuy = rebuy;
        }

        public void setPay(boolean pay) {
            this.pay = pay;
        }

        public void setComment(boolean comment) {
            this.comment = comment;
        }

        public void setDelete(boolean delete) {
            this.delete = delete;
        }

        public void setAftersale(boolean aftersale) {
            this.aftersale = aftersale;
        }

        public void setRefund(boolean refund) {
            this.refund = refund;
        }

        public boolean isCancel() {
            return cancel;
        }

        public boolean isConfirm() {
            return confirm;
        }

        public boolean isRebuy() {
            return rebuy;
        }

        public boolean isPay() {
            return pay;
        }

        public boolean isComment() {
            return comment;
        }

        public boolean isDelete() {
            return delete;
        }

        public boolean isAftersale() {
            return aftersale;
        }

        public boolean isRefund() {
            return refund;
        }
    }
}
